<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="plugins/webuploader-0.1.5/webuploader.css">
	<link rel="stylesheet" type="text/css" href="css/pages/public.css">
	<link rel="stylesheet" type="text/css" href="css/pages/brand-version.css">
</head>
<body>
	<h2>品牌机型设置</h2>
	<div id="app-root" class="container" v-cloak>
		<button class="btn btn-default add-brand-button" @click="addMobileBrand">添加品牌</button>
		<table class="table table-bordered">
			<tr>
				<th>品牌</th>
				<th>机型</th>
			</tr>
			<tr v-for="brand in brands">
				<td class="brand-name"><span @click="editMobileBrand(brand.bid)">{{brand.b_name}}</span><i class="fa fa-trash" aria-hidden="true" @click="delete_brand(brand.bid)"></i></td>
				<td class="version-container">
					<div class="version-item" v-for="version in brand.version">
						<div class="version-img"><img v-bind:src="version.v_imgurl" @click="editMobileVersion(version.vid)"></div>
						<div class="version-name"><span>{{version.v_name}}</span><i class="fa fa-trash" aria-hidden="true" @click="delete_version(version.vid)"></i></div>
					</div>
					<div class="add-version-button">
						<button class="btn btn-default" @click="addMobileVersion(brand.bid)">添加机型</button>
					</div>
				</td>
			</tr>
		</table>
		<div class="modal fade" id="brandModal" tabindex="-1" role="dialog" aria-labelledby="brandModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="brandModalLabel">{{m_title}}</h4>
					</div>
					<div class="modal-body"><input type="text" class="form-control" v-model="b_name"></div>
					<div class="modal-body" v-show="error">
						<div class="alert alert-danger" role="alert">
							<strong>Warning!</strong> {{error_message}}
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="button" class="btn btn-primary" @click="submitBrand">确定</button>
					</div>
				</div>
			</div>
		</div>
		<div class="modal fade" id="versionModal" tabindex="-1" role="dialog" aria-labelledby="versionModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="versionModalLabel">{{m_title}}</h4>
					</div>
					<div class="modal-body"><input type="text" class="form-control" v-model="v_name"></div>
					<div class="modal-body" id="dynamic-html"></div>
					<div class="modal-body" v-show="error">
						<div class="alert alert-danger" role="alert">
							<strong>Warning!</strong> {{error_message}}
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="button" class="btn btn-primary" @click="submitVersion">确定</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/vue.min.js"></script>
	<script type="text/javascript" src="plugins/webuploader-0.1.5/webuploader.min.js"></script>
	<script type="text/javascript" src="js/pages/brand-version.js"></script>
</body>
</html>